f256a074507857572db4784a3e13653bd2e7bc89,src/org/openstreetmap/josm/tools/OsmUrlToBounds.java,OsmUrlToBounds,parse,#String#,11
Before Change
double size = 180.0 / Math.pow(2, Integer.parseInt(map.get("zoom")));
b = new Bounds(
new LatLon(parseDouble(map, "lat") - size/2, parseDouble(map, "lon") - size),
new LatLon(parseDouble(map, "lat") + size/2, parseDouble(map, "lon") + size));
}
} catch (NumberFormatException x) {
} catch (NullPointerException x) {
After Change
public static Bounds parse(String url) {
Bounds b = parseShortLink(url);
if (b != null)
return b;
int i = url.indexOf('?');
if (i == -1)
return null;
String[] args = url.substring(i+1).split("&");
HashMap<String, String> map = new HashMap<String, String>();
for (String arg : args) {
int eq = arg.indexOf('=');
if (eq != -1) {
map.put(arg.substring(0, eq), arg.substring(eq + 1));
}
}
try {
if (map.containsKey("bbox")) {
String bbox[] = map.get("bbox").split(",");
b = new Bounds(
new LatLon(Double.parseDouble(bbox[1]), Double.parseDouble(bbox[0])),
new LatLon(Double.parseDouble(bbox[3]), Double.parseDouble(bbox[2])));
} else if (map.containsKey("minlat")) {
String s = map.get("minlat");
Double minlat = Double.parseDouble(s);
s = map.get("minlon");
Double minlon = Double.parseDouble(s);
s = map.get("maxlat");
Double maxlat = Double.parseDouble(s);
s = map.get("maxlon");
Double maxlon = Double.parseDouble(s);
b = new Bounds(new LatLon(minlat, minlon), new LatLon(maxlat, maxlon));
} else {
b = positionToBounds(parseDouble(map, "lat"),
parseDouble(map, "lon"),
Integer.parseInt(map.get("zoom")));
}
} catch (NumberFormatException x) {